cursor in sql server example with stored procedure