SQL procedure execution fixes