Reviving an old thread to provide information.
Programming a key to your BMW's CAS will cost you money, regardless if you DIY or pay someone to do it. The tools for you to DIY will be in the $200 range for chinese clones and the process takes 15 min.
1: It's FAR easier to program a virgin key than a 'used key'. Virgin keys are $15 USD on Aliexpress.
2: A used key will need to either have the transponder de-soldered and a new one soldered in ($4 per transponder chip) OR you can purchase a PCF79xx Unlocker, or Xhorse VVDI PROG Programmer, and fiddle around with that to erase the data from the transponder. As you can see, you're better off buying a virgin key!!!
3: You can use HiTag2 to use data from a working key and create a 'new key' file for use in BMW Explorer/EF Scanner
4: With a battery tender/charger on your car, use EF Scanner to program the new key to the CAS.
Here's how: