>IF ( SELECT COUNT(*) FROM MyTable WHERE PkId = @PkId ) < 1 >BEGIN > RAISERROR('The record you are looking for aint there.',16,1) >END >>
IF NOT EXISTS(SELECT [PK] FROM [MyTable] WHERE [PK] = @PK) ...If this query is used a lot, there should be a nonclustered index on PK.