Start a new sketch, it will already include the files that match the IDE version. Paste in the old sketch as a text copy from clipboard. Debug. Repeat until no bugs. There will be differences and one or more might or might not matter. Usually simple sketches just run the same for me.
You can #include <Arduino.h> // just to be sure whichever way you load the sketch
To what extent does the compiler not include unused functions, etc? IIRC if you only use one function in <string.h> then the rest don't get compiled. If nothing calls <Wprogram.h> then it won't be in the final image.