How can I build a circuit to convert sine waves to square waves at up to 1MHz?
You do not say the voltage of the sinewave and you do not say the amount of output voltage and current you need.

The 74LS14 needs a supply voltage of 5V and produces an output of about 0.1V to +3.5V at a few mA.
The 74HC132 needs a supply voltage from 2V to 5.5V and produces an output almost the same as its supply voltage at a few mA.

The datasheets show the ranges of input signals needed.