The error points out that there might be some problem. You’re either running this procedure more than once or you’re running msiAttach in another proc also. msiAttach only needs to be executed once per namespace.
If you want to run this proc twice then just catch the msiAttach statement:
catch { msiAttach }
Or move the msiAttach statement to a place where it’s only executed once, like in the startup section of a TPS procedure.