declare  @a bigint
if exists(select * from tb where id=@id)
set @a=@ID
else
set @a=0set @id=@a