ods path (prepend) WORK.TEMPLAT(update);
This ensures that the TEMPLATE procedure operates correctly from IML Studio.
%let __IMLSTUDIO=1;
You can detect that your SAS code is running from IML Studio by querying for the macro variable __IMLSTUDIO.