@NotNull
    public static String getResolvedNewScriptTemplate(@Nullable DBPDataSourceContainer container) {
        if (container != null) {
            final DBPPreferenceStore store = container.getPreferenceStore();
            if (store.getBoolean(SQLPreferenceConstants.NEW_SCRIPT_TEMPLATE_ENABLED)) {
                return GeneralUtils.replaceVariables(
                    getNewScriptTemplate(store),
                    new SQLNewScriptTemplateVariablesResolver(container, container.getConnectionConfiguration())
                );
            }
        }
        return "";
    }
A {@link IResource}'s session property to distinguish between persisted and newly created resources.
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorUtils.java