The rule of thumb is that, if the sensor was substituted after mid-2015, there should not be any problems. It would be a new sensor generation. But you cant tell by the serail number of the camera, unless you contact Leica directly. Here are a few ways to be sure what sensor is in your camera, and if buying a M9 preowned ask the seller to prove the information.
To check are here some methods to do a proper check. Also, notice it is better to go through both methods to know if the sensor is the correct one.
You can write Leica providing the serial number and ask them if the sensor is new or old. They are the ones who have done the sensor replacement, and will have the informations.
You will find the information in the camera
Power on your Leica M9.
Activate by taking these actions: Push the delete button -> up (2x) -> down (4x) -> left (3x) -> right (3x) -> Info.
Then select (SET button) on hardware IDS and check the CCD ID number.
If you have 15 or 16 and above that number then it’s the new sensor (unless it is a very clever seller and the owner knows how to hack the M9 and set a fake number).
This all applies for M9, M9-P but not M monochrom as far as I know.
A further third extra check to see if the current sensor is free of corrosion is to point the camera to a bright sky, having the aperture closed down to add as much depth of field as possible. No corrosion, no problem.