Short answer is no. 20V across brands is not a universal standard. Most 20V lithium tools are nominally 18V and the 20V label is just marketing, but the battery rails, contact pins, and the battery management are brand specific. Packs rarely fit other brands and the chargers are not cross compatible. There are adapters out there, but they add extra resistance, can confuse the fuel gauge, may void warranties, and you still cannot charge cross brand.
If your packs are DeWalt 20V MAX, the DeWalt DCD771C2 will run on them because it is part of the 20V MAX platform and uses the same slide battery interface. If your packs are from another brand, your best move is to buy a drill only tool within that same line so you can keep using your existing batteries and charger.