select a.index_id, name, avg_fragmentation_in_percent
from
sys.dm_db_index_physical_stats(DB_ID('AdventureWorks'),OBJECT_ID('Production.Product'),NULL,NULL,NULL) as a
INNER JOIN sys.indexes as b
on a.object_id = b.object_id
and a.index_id = b.index_id