Here is what we came up with. It does rely on the query plan still being in the cache:-------------------------------------------------------------------------------- Given an index name, find where it is used-----------------------------------------------------------------------------declare @IndexName sysname = 'MyIndex'select DB_Name(st.dbid) dbName, Object_Name(st.objectid) ObjName, st.text SqlText, qp.query_plan, cast(qp.query_plan as varchar(max)) vcQueryPlanFROM sys.dm_exec_query_stats AS QSCROSS APPLY sys.dm_exec_query_plan(QS.plan_handle) as QPCROSS APPLY sys.dm_exec_sql_text(QS.sql_handle) as STwhere qp.query_plan is not Nulland cast(qp.query_plan as varchar(max)) like '%' + @IndexName + '%'and Object_Name(st.objectid) is not Null -- Not Null for sprocs, funcs, et al; Null includes ad hoc queries, too
=======================================Few things are harder to put up with than the annoyance of a good example. (Mark Twain)