No better built in solution.
My question is more like why you want to use stored procedures for this at all.
Why not write this code in your application programming language instead. Much better string handling and much more complete language.
And I’m sure you have a good reason, but I’m curious why you have to create new tables so often that you feel that you should create a stored procedure for it?
When I write an application you design the database once and after that the application runs on that design until you upgrade it and at that point you have a SQL-script that you have tested a lot of times that performs the upgrade.
As you can understand I’m not that very fond of Stored Procedures in the first place, they have their uses when you for example want to avoid sending a lot of data over the link to the client, etc, and banks for example use them to place security in the DBMS instead of creating a well defined API that the application is using for accessing the data.
But my main reason why I avoid them is that I think that it gets harder to debug applications that use them. Since you can’t for example step through all code since some of the functionality is placed in the stored procedure and you can’t usually step through the code in the stored procedure in your normal debugger.