I want to secure a dock ladder to a wooden dock with 4 lag screws. The wooden dock surface is 2"thick wood.
If the dock is made from hardwood, then you want about a 7/16" pilot hole. If it is softwood, about 3/8"
If possible, don't use screws at all, but rather use through bolts with nuts and washers. They will be much more secure long term.
In general, you want the size of the pilot hole to be about that of the root diameter of the screw around the threads. See this thread from DIY Stackexchange