The main objective of an adjustable height work surface is to keep it in the same attitude while changing the height. Unlocking simply to make the adjustment, almost weightless (minimum effort) to make change in height, and then simple re-locking. Also the volume needed for the desk beyond the foot print is important.
Almost effortless adjustment is done best by having a balanced weight of the desk surface. I would suggest using water for the counter weight since it would not have to be shipped or carried. Could be added or removed in smaller proportions and could even counter balance unknown in design weight on the desk. If the weight variation is significant then, range of weight needed to be change height can only be done by some mechanical advantage approach or a motor powered mechanism to provide the advantage.
Spur and Helical gears can be back driven so a holding means is needed; friction or latch that with a lever is unlocked and re-locked. If the travel of the gear is less then say at most 120 degrees then linkage is often a better approach. The adjustable desk tops that are placed on an existing desk use linkages instead of gears and a locking mechanism.
For assisted or mechanical advantage requirements worm gears of ACME threads can provide self locking or a ratchet used in older jacks can be used . The operator to make an adjustment must move the worm, nut, or ratchet linkage to make and adjustment. Motorized would be commonly used since the travel needed for the mechanical advantage would be substantial.