• perhaps your particular login does not have permissions top create temp tables. instead of using #sp create a table perhaps to accomodate the contents of #sp and modify the code appropiately...

    something like this:

    CREATE TABLE sp

    (

    spid BIGINT IDENTITY(1, 1),

    sptext TEXT NOT NULL,

    spname VARCHAR(100) NOT NULL

    )

    then use the find and replace function to replace #sp with sp