
--To obtain the original and the current cost of a cached entry use the query below:
 
select text, usecounts, 
       original_cost, current_cost, 
       disk_ios_count, context_switches_count, 
       pages_allocated_count 
from sys.dm_exec_cached_plans cp 
cross apply sys.dm_exec_sql_text(plan_handle) st
join sys.dm_os_memory_cache_entries ce 
on cp.memory_object_address = ce. memory_object_address 
go
