The way it was explained to me is that the dealer programs the car to respond to the remotes. All the remotes the car will respond to have to be present when the programming is done. The dealer uses the Consult tool to do this. I'm not sure of the process used by locksmiths to get the job done.
My dealer will sell a new remote, cut the key, and program the car for $300. I bought a new remote and key for about $100. The dealer charged me $80 to cut the key and program the car so it would recognize both remotes. Contact your service department and see what your options are, and the cost. When I got the second remote, a local locksmith wanted $125 for programming and to cut the key, where the dealer only charged $80.