• Try this:

    create procedure [proc1] @cursor_name cursor varying output

    as

    declare @string nvarchar(1000)

    set @string = 'declare cursor_name cursor for

    select blah from foo ' + char(13)

    if len(@p_vcwhere) <> 0 set @string = @string + ' where ' + @p_vcWHERE

    exec sp_executesql @string

    This will return a cursor.

    Jeremy.