IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID('[dbo].[checktrigger]') AND type = 'FN')
DROP FUNCTION [dbo].[checktrigger]
GO
create function [dbo].[checktrigger](
@trgname varchar(100)
)
RETURNS int
begin
declare @re int 
IF  EXISTS (select * from sys.objects where type='tr' and object_id = OBJECT_ID(@trgname))
set @re = 0 else set @re = 1 
return @re
end