I needed to change SQL Server Account and Agent Account names and passwords across 15 servers due to a compliance issue. This script can streamline that process for you. I have included detailed comments in the script. This script is not a fire and forget script. You must interact with the script to validate that a successful backup was taken prior to making any changes.
If each instance that is to have an account changed needs a different name and password a variable will need to be added dynamically pass that into the script.
I hope you find this useful.