Instead of trying to assign the output parameters inside EXISTS to do the assignment, then check @@rowcount to see if matching matches were found.
ALTER PROCEDURE dbo.LoginEmp @username NVARCHAR(10), @password NVARCHAR(10), @confirm INT output, @emp_name NVARCHAR(50) output, @emp_id BIGINT output AS SELECT @emp_id = emp_id, @emp_name = emp_name_ara FROM Employee WHERE ( emp_username = @username AND emp_password = @password ) IF @@ROWCOUNT = 1 BEGIN SET @confirm=1 INSERT INTO EmployeeLog (log_emp_id, log_act_id, log_date, log_data) VALUES (@emp_id, 1, GETDATE(), -1) END ELSE BEGIN SET @confirm=0 END
source share