declare @IndexName nvarchar(100) = '[MyIndex]';
with xmlnamespaces (default 'http://schemas.microsoft.com/sqlserver/2004/07/showplan')
select object_name(qp.objectid),
cp.usecounts,
qp.query_plan
from sys.dm_exec_cached_plans as cp
cross apply sys.dm_exec_query_plan(cp.plan_handle) as qp
where cp.objtype = 'Proc' and
qp.query_plan.exist('//RelOp[
@PhysicalOp = "Index Seek" and
IndexScan/Object/@Index = sql:variable("@IndexName")
]') = 1;
The index in the query plan has square brackets so you need to have that in your variable.
//RelOp
does a deep search for all RelOp
nodes picking the ones where @PhysicalOp
is Index Seek
and there exists a child node IndexScan/Object
where @Index
is what you have stored in your variable.