This is an excellent script that I will be keeping close at hand. Thank you for seeing the need for this and taking the time to create the solution. All too often, when copying a database from one server to another, DBA's tend to focus on the files, and the realignment of the SiD's, and never consider roles at all. This script fills that inadvertent gap.
Thank you,
Jeff Bennett
Missouri, US