• Well, if the names change as well it become more cumbersome and a simple manual replace no longer cuts it.

    Options I would look into would be a text editor with scripting, a simple C# or VB program, or as you already mention Powershell. We do have a Powershell forum in here as well, though that is mostly geared towards using powershell for SQL tasks, you might find help there. Or you could find a non-SQL related forum on the internet.

    (Note: it probably is possible to do this in SQL Server as a mental exercise for fun, but it's not the right tool and you'd be spending a lot of time to tweak it. I'm not going to spend time on this)


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/