You can use the NOEXEC setting for this, but be careful. When you turn on NOEXEC ON, you should turn it back to the OFF position at the end of your script.
IF (CONDITION) SET NOEXEC OFF --Enables execution of code (Default) ELSE SET NOEXEC ON --Disables execution of code GO ALTER PROCEDURE MYPROC AS --STATEMENTS GO --END OF ALTER BLOCK SET NOEXEC OFF --RESTORES NOEXEC SETTING TO ITS DEFAULT
Jairo ramírez
source share