>How do you drop table #SPList? That is, if I run your script more than one time, the error message is that this object is already in DB. So, I suppose, I need to drop it first, if it exists.
>
if object_id('tempdb..#SPList', N'U') is not null drop table #SPList;
If it's not broken, fix it until it is.
My Blog