SQL templating and versioning