How to enable PIC16 watchdog timer for software control?
Assuming you are using MPLABX, go to Window->PIC Memory Views->Config bits. 

Select the desired WDT option (one of four) and click on "Generate Source Code to Output"



You will see the required #pragma 

#pragma config WDTE = SWDTEN    // Watchdog Timer Enable (WDT controlled by the SWDTEN bit in the WDTCON register)