Controlling op amp gain digitally
It's a pretty terrible way. The BJT has some offset and the base current will affect the output. A MOSFET would work better, but only for positive outputs, and the MOSFET has to have a low enough Vgs(on).
I would suggest using an analog switch, but the details depend on the power supply rails and input logic level. In particular you should avoid running any current (other than op-amp bias current) through the switch, so something like an SPDT switch is best. You might also have to add a bit of capacitance in the negative feedback path to ensure good phase margin.

16.2K for R2 and 1.05K in series with 750 ohms for R1 has zero nominal error and uses standard E96 values. Alternatively 18K for R2 and 2K for R2 uses standard E24 values and only two resistors.