To clear procedure cache for one database, run ALTER DATABASE SCOPED CONFIGURATION CLEAR PROCEDURE_CACHE inside that database. This post tests it on two demo databases, shows that the other database keeps its plans, and shows how to remove a single plan by its plan handle. It also covers the cost and the lighter alternatives.
The sp_ Prefix: Finding Stored Procedures Named the Risky Way
Find user procedures with the sp_ prefix across databases, understand the lookup risk, and move callers through a synonym safely.
How to Identify Session Used by SQL Server Management Studio? – Interview Question of the Week #151
An interview candidate asked us: how do you identify session IDs that SQL Server Management Studio is using? Here is a simple answer with sp_who2.
SQL SERVER- New DMF in SQL Server 2017 – sys.dm_os_file_exists. A Replacement of xp_fileexist
SQL Server 2017 adds a new DMF, sys.dm_os_file_exists, a replacement of xp_fileexist that suits both Windows and Linux. Here is how to use it.
Stored Procedure Execution Count and Average Elapsed Time
To find a stored procedure execution count, query sys.dm_exec_procedure_stats and divide the total elapsed time by the count. This post builds a demo, shows the query, and explains why the numbers start again when a plan leaves the cache. It also fixes the object name lookup that returns NULL for other databases.
Run a Stored Procedure at Startup in SQL Server
To run a stored procedure at startup, create it in the master database and mark it with sp_procoption. This post builds a demo that writes one row every time the instance starts. It also covers the rules, how to check the setting, and how to turn it off again.







