Fix bug where an extend caused a view to be created inside a stored procedure, should have stayed a temporary table.