select [Average Duration (msec]=total_elapsed_time/execution_count/1000, creation_time,last_execution_time, execution_count from sys.dm_exec_query_stats where plan_handle in ( SELECT plan_handle FROM sys.dm_exec_cached_plans CROSS APPLY sys.dm_exec_sql_text(plan_handle) CROSS APPLY sys.dm_exec_query_plan(plan_handle) where text like '%<sql text>%' )
SELECT UseCounts, Cacheobjtype, Objtype, TEXT, query_plan, plan_handle FROM sys.dm_exec_cached_plans CROSS APPLY sys.dm_exec_sql_text(plan_handle) CROSS APPLY sys.dm_exec_query_plan(plan_handle) where text like '%<sql text>%' order by text DBCC FREEPROCCACHE(<plan_handle>)