create procedure sp_clearmem
as
begin
dbcc freeproccache
dbcc freesessioncache
dbcc freesystemcache('all')
dbcc dropcleanbuffers
exec sp_configure 'max server memory',256
exec('reconfigure')
waitfor delay '00:00:05'
exec sp_configure 'max server memory',2147483647
exec('reconfigure')
end