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

Then start exploring IDE example codes. They are well documented, lots of comments telling what the lines are doing.
Of course You look for any sight of speed thoughts....

Searching forum for servo + speed is another tip.