Do I have to flash the computer in my 2005 Cadillac Deville after replacing the transmission with a used unit
As Ben commented, if you use an identical part (same model and part number as the original one) then you should not need to reflash, as the expected settings will be different.
If, however you have used a different model/part then you will need to look at the guidance on whether it requires a reflash. Cadillac should have guidance on requirements, or sites like cardone.com and cargurus.com have useful info.
The TCM is a separate unit on this model so generally you will not need to flash/update it when replacing/updating the ecu in most cases. However sometimes with newly updated ecu calibrations from GM there are certain flashes that do require you update the TCM (sometimes other modules as well) or they will not function correctly and will toss out bad calibration DTC's. I do not remember one for the 2005 Cadillac Deville tho so you should be good.