I have purchased a number of keys through the years, always from the dealer, and the only time I recall anyone had to bring the new key to the car to code it to the car was the master key for my e46. For the e36s, I give them the VIN and they generate the key with a pattern and code already set for the car.
Good luck getting the old lock cylinder out with a stiff wire in the release hole. New ones come right out, but old ones won't budge. Most likely you will have to take a dremmel tool and cut slots in the security bolts and replace the lock and the housing.
There are instructions for repairing broken lock cylinders on one of the BMW Forums that were posted a few months ago, but the lock itself is most likely pretty worn, so I am not convinced that reparing the stop pin that has failed is a good long term solution.