def sql_render(hpo_id, cdm_schema, results_schema, vocab_schema, sql_text):
    """
    Replace template parameters
    :param hpo_id: will be the source name in Achilles report
    :param cdm_schema: schema of the cdm
    :param results_schema: schema of the results tables
    :param vocab_schema: schema of the vocabulary tables
    :param sql_text: SQL command text to render
    :return: command text with template parameters replaced
    """
    result = sql_text

    replacements = {'@cdm_database_schema': cdm_schema,
                    '@results_database_schema': results_schema,
                    '@vocab_database_schema': vocab_schema}

    for raw_placeholder, schema in replacements.items():
        placeholder = raw_placeholder + '.' if schema is None else raw_placeholder
        replace_with = '' if schema is None else schema
        result = result.replace(placeholder, replace_with)

    return result.replace('@source_name', hpo_id)