A 1khz (for example) square wave is made up from a 1khz sine wave plus all the odd harmonics, 3khz, 5khz, 7khz... etc etc.
So, use either a bandpass filter which will allow just the 1khz funamental to pass or a lowpass filter which attenuated all the harmonics, and you are left with a sine wave.
Now, whether this a a sensible or practical thing to do is a totally different question. It depends on your application.