I had a temp table called #t that I used to generate the add job steps queries. When I removed that my problem disappeared.