store list of data into variable store procedure

First of all i excuse me if this question looks very simple for you. Since, i have no idea how to write sp i am posting this question:
Basically i want to write store procedure for and my use case is:

select distinct id from table