Is there a way, in a script, to check if a stored procedure already exists?
What I want to do is either create or alter a stored procedure. Create, if it does not already exists. Alter, if it does exists. So I'm thinking if the script can see if it exists then it can drop it. Then I can use create procedure and it will work for either case.
I want to do it this way as I'm creating scripts to be applied to various client databases and some clients already have versions of these stored procedures in their database and other clients don't.
Can this be done?
Thanks in advance.
What I want to do is either create or alter a stored procedure. Create, if it does not already exists. Alter, if it does exists. So I'm thinking if the script can see if it exists then it can drop it. Then I can use create procedure and it will work for either case.
I want to do it this way as I'm creating scripts to be applied to various client databases and some clients already have versions of these stored procedures in their database and other clients don't.
Can this be done?
Thanks in advance.