This is not supported as the code is updating the replication metadata tables. If the distributor server name changes from S1 to S2, the only supported way is to drop and recreate all replication. The distribution server name is hardcoded in the jobs, system tables, agent profiles and many other places. There will be issues if the distribution server changes as part of the update.
The below code is updating replication metadata tables and it’s not supported:
10.Update MSpublisher_databases table with correct publisher id:
set t.publisher_id =@srvid
FROM [$(DistributionDB)].[dbo].[MSpublisher_databases] t
Stacy Gray (Sql 3T)
SQL Server Engine