Is the question about how to version the query? You have comments before the query that allow you to name the exported function so you could have both queries and name them something different.
Hibernate Query Language. How is it out of context?
Use Named Native Query and you have SQL queries.
I really don’t understand the objection to ORMs. By that logic, you might as well reserve a block of memory and offsets instead of class/struct attributes.
SQLc you write the queries, it generates the boilerplate functions to execute them.
This works better than an ORM because you don't have to deal with an ORM.