Local squawks are issued from a list at each SSR equipped unit. In most cases they are limited to a small block like 7201 to 7207 for one particular unit. These will normally be allocated for local flying in that ATC unit's area of responsibility.
For Airways traffic the squawks are generated from the UK allocated block and attached to the flight plan information which goes to every major UK unit. That means if you depart Heathrow and land at Aberdeen you will retain the same squawk and each ATC unit along the way will be aware of your squawk.