if not exists (select name from dbo.sysobjects where name='F_S_GetDraftReceipt') begin exec('create FUNCTION dbo.F_S_GetDraftReceipt() returns @tbl table(ID int) as begin return end') end