How to migrate SQL Server credentials from 2005 to 2008 R2
I'd suggest you take a look at the Copy-DbaCredential Powershell cmdlet from dbatools.

From their web page on this cmdlet:


  By using password decryption techniques provided by Antti Rantasaari
  (NetSPI, 2014), this script migrates SQL Server Credentials from one
  server to another, while maintaining login names and passwords.


Here is an example of how you'd invoke this cmdlet

Copy-DbaCredential -Source sqlserver2014a -Destination sqlcluster