Few days ago, there was complex condition when we had one database on two different server. We were migrating database from one server to another server using nightly backup and restore. Based on database server stored procedures has to run different logic. We came up with two different solutions.
1) When database schema is very much changed, we wrote completely new stored procedure and deprecated older version once it was not needed.
2) When logic depended on Server Name we used global variable @@SERVERNAME. It was very convenient while writing migrating script which depended on server name for the same database.
SELECT @@SERVERNAME AS 'Server Name'
Reference : Pinal Dave (https://blog.sqlauthority.com)