IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[checkprocedure]') AND type = 'FN')
DROP FUNCTION [dbo].[checkprocedure]
GO
create function [dbo].[checkprocedure](
@prcname  varchar(100)
) 
RETURNS int
begin
declare @re int 
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(@prcname) AND type in (N'P', N'PC')) 
set @re = 0 else set @re = 1 
return @re
end