Hi,
Here, there are two different case..
1. Your code does not work properly at 20 MHz despite of it works with at 4 MHz clock.
2. Execution does not start in generally on your 16F877A.
If case 1 happens, you need to review your code. Serial communication or timing dependent functions might not work properly when clock frequency changed but necessary timing and settings were ignored.
If case 2 happens, I can think as first that you did not set your 16F877A to HS clock speed.. You have to select from your programmer (or in your code HS clock options)
Regards.