IF (SELECT COUNT(*) FROM tb WHERE empno=@empno AND deptid=@deptid ) > 0
PRINT "Emp/Dept already exist&";
ELSE IF (SELECT COUNT(*) FROM tb WHERE empno IS NULL AND deptid=@deptid ) > 0
PRINT "ERROR Dept already exists";
ELSE IF (SELECT COUNT(*) FROM tb WHERE empno=@empno AND deptid='') > 0
PRINT"Emp Already Exists&";
ELSE
INSERT INTO tb VALUES(@empno, @deptid)
tb - your table, @empno,@deptid - stored procedure input parameters