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