CORE-1618 Support defining createProcedure body in an external file

Refactored new code and fixed failing tests