• Thanks for the feedback.

    Your are right with the issue with renamed columns, I have already runned into it, but it is not easy to fix, as it would need to be aware of the changed it is going to do, and with defaults matching other columns. Because of this I decided people should tweak the scripts themselves

    I would also like to have every dba proc's in one database, but it is not possible to do dynamic sql in table valued functions. This means that all my renaming sproces would have to duplicate the TVF code into the sproc sometimes numerous times, and that would make code reuse and maintenance impossible.

    The reason I have to use dynamic code in TVF, is because I query sys tables a lot, and those contain local database schema information only, hense the need for dynamic sql. I also use the TVF alot in other unpublished script at work. It would have been nice if Transact SQL supported the ability to have functions inside sprocs, which can only be called from the sproc. Kinda like functions declared in functions as in pascal