Variable Declaration and If Condition in Sql Server Stored Procedure
Create Proc Usp_CheckStatus @id int As Begin Declare @status nvarchar(50) Set @status=(select status from TblUsers where id=@id) If(@status='active') Begin ---Your Block of Code/query End End