How does a company know your new credit card number before you give it to them?

If you cannot stop automatic payments from hitting your credit card, you might cancel that card and get a new number. However, when Kevin Patterson tried that, his credit card company gave his new number to the very company he was trying to stop.