Question: How can I set resultset value to local variable or output parameter in procedure..

For below.

```
UPDATE TOP (1) certificate WITH (ROWLOCK,READPAST,UPDLOCK) 
SET issued = 1 
OUTPUT INSERTED.certid, INSERTED.certiname
WHERE  issued = 0 AND year = 2011 

```

Answer: 
You can define a table variable to hold the output:

```
DECLARE @OutputTable TABLE (CertID INT, CertiName VARCHAR(100))  -- adapt as needed

UPDATE TOP (1) certificate WITH (ROWLOCK,READPAST,UPDLOCK) 
SET issued = 1 
OUTPUT INSERTED.certid, INSERTED.certiname INTO @OutputTable
WHERE  issued = 0 AND year = 2011 

SELECT * FROM @OutputTable

```

and you can then select from that table variable to return the data from your stored procedure (or just to peek into it).

PS: the `WITH (UPDLOCK)` is absolutely superfluous - any `UPDATE` statement will always take an update lock anyway...... you can just leave that out entirely.
```
DECLARE @certid INT
DECLARE @certinname VARCHAR(MAX) -- or whatever
UPDATE TOP (1) certificate WITH (ROWLOCK,READPAST) 
SET issued = 1, @certid = certid, @certinname = certinname
WHERE  issued = 0 AND year = 2011
SELECT @certid, @certinname

```