if (select dbo.routineExists('procedureExists', 'function')) = 1 drop function dbo.procedureExists go exec dbo.sp_executesql @statement = N' /* Created: 07.22.2008 by Boyan Kostadinov (boyank@gmail.com) Dependencies: information_schema.routines Parameters: @procedureName varchar(255) - The name of the procedure Usage: select dbo.procedureExists(''getCopyInformation'') if (select dbo.procedureExists(''getCopyInformation'')) = 1 print ''exists'' Returns: 0 if the procedure does not exist 1 if the procedure exists Description: A wrapper for the dbo.routineExists that explicetly checks for the existance of the procedure name passed in */ create function dbo.procedureExists(@procedureName varchar(255)) returns bit as begin return (select dbo.routineExists(@procedureName, ''procedure'')) end '