A DMV query that grinds to five or ten minutes against a large plan cache is a real failure mode, not a hypothetical one — joining sys.dm_exec_query_stats to sys.dm_exec_sql_text row by row scales badly once the cache holds enough plans. sys.dm_exec_procedure_stats exists to sidestep exactly that cost: one row per …
Read MoreSQL Server Search Stored Procedure and View Text
Apr 9, 2026 / · 10 min read · sql server sql scripts sys.sql_modules sys.objects stored procedures views database administration object search maintenance scripts schema management ·Before a column is renamed or a table is dropped, the question is which procedures, views, and functions still mention it. This script answers that by searching the stored text of every SQL module in the current database for a keyword, matching on the object name as well as the definition. It returns the schema, object …
Read More