How to create a program that controls the speed of a servo using a potentiometer using arduino?

You could use the MoToServo class of my Mobatools Library. This class has a method to set the speed of the Servo.