Mode S transponders
As far as I am aware, Mode "S" transponders are pre-programmed with a code assigned by the regulatory authority, like the registration.
It is electronically tagged so that the specialist equipment interrogating the transponder knows which aircraft it is interrogating.
The flight crew have nothing to do with this code and it is separate from the requirement to input the flight number into the FDR or GNSS!
That said, an aircraft that carries out any number of sectors for any given day, week, month or year will always carry the same mode "S" code, the atc computers just need to keep up!