template: added support for user defined procedures with template body