The connection string is just a string. It's very simple string manipulation to change the server name in a connection string. I would suggest just putting a known tag in the connection string in place of an actual server name. When you want to change the server name, it's a very simple call to the Replace method on the string to replace the known tag with the server name.
As for encrypting the username and password, you don't. You encrypt the entire connection string in your app.config file. Read
this[
^].