The best result will come from combining the remaining good cells from two packs to build one good pack.
Start by charging the batteries, preferably a good old overnight trickle charge. If you only have a fast charger, you can use a bench power supply. Set it to about 100 mA and a voltage at least 1.5x the nominal pack voltage (18 V for a 12 V pack), and charge 24 hours. Don't worry about over-charging, NiCd are happy to be overcharged at this low rate. Now that you have all cells fully charged, wait and check which cells are self-discharging. You will need to open the pack to have access to all individual cells. I'd just let it sit overnight and then check which ones are still over 1.2 V when put under a load of ~ 0.5 A. If you have only one or two bad cells in the entire pack, the easy fix is to just short them out (after discharging any residual energy from them) by soldering a wire over them. Then your 18 V pack become 16.8 or 15.6 V, but it will work just fine. If you have several bad cells in each pack, combine the good ones into one pack. You can cut the spot-welded tabs that connect the cells, and solder those tabs together in the new arrangement (never try to solder to the cells).
You can also try to zap life back into the bad cells. These often have a high internal resistance, which can be overcome with a lot of current. You will need to do this per-cell, not on the whole pack. For sub-C cells (most common), I use a 20 A bench supply. The bad cells will show a high voltage at first (over ~10 V), but as the internal resistance drops, the voltage will drop to 2 to 3 V. This usually takes 2 to 5 seconds. Be aware of cell temperature and stop if it becomes more than warm. This zapping can make the pack chargeable and usable for a while, but within weeks, it will return to a bad state.
The best advice to maintain good life of multi-cell NiCd and NiMh packs, is to stop using the device as soon as the voltage starts to drop. By the time you notice that the drill is slowing down a little, one or more cells are completely drained while others still have some charge in them. Continuing to use the device will force current through those drained cells, effectively charging them in reverse and causing damage. Don't try to get that last 5 or 10 % of charge from the pack, just stop and recharge.