The proc really runs a dbcc flushprocindb
Here's the code..
create procedure sp_flush_db_procs
@dbname sysname=NULL
--
-- Flush the Procedure cache for a database.
--
-- If no database name is supplied then flush
-- the current database.
--
-- WARNING: This SP uses an undocumented MS SQL
-- DBCC command to do its business. So
-- it might not be supported beyond the
-- current version of SQL, Version 7.
--
-- D. Winters 2/8/2002
--
as
declare @dbident int
set nocount on
begin
if @dbname is null
select @dbident = db_id()
else
begin
select @dbident = db_id(@dbname)
if @dbident is NULL
begin
RAISERROR ('Invalid DB name specified.', 16, 1)
RETURN(1)
end
end --if
dbcc flushprocindb(@dbident)
select 'Flushed procedure cache for: ',db_name(@dbident)
end
--------END
GO