I am looking to alter a stored procedure if a condition exists. I want to leave the stored procedure as is if the condition is not met, so drop/create is not really an option.
Trying to put the contents of ALTER PROC inside an IF block is throwing up errors for me. Any thoughts?
IF (condition)
EXEC ('ALTER PROC ...')
ALTER/CREATE PROC must be first in the batch so this is the only way. Unless you do this
IF NOT (condition)
RAISERROR('abort connection with high severity', 20, 1)
GO
ALTER PROC ...
GO
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With