I am trying to debug some trigger code and want to be able to examine
the contents of inserted, deleted, temporary tables etc. There doesn't
seem to be a way to do this directly from the debugger so I hit on the
idea of using a local variable to control the selecting of these tables.
if exists (select 1 from sysobjects where name = 'test' and type = 'P')
drop procedure test;
if not exists (select 1 from sysobjects where name = 't1' and type = 'U')
CREATE TABLE t1 (a int PRIMARY KEY)
if exists (select 1 ...