show/hide this revision's text 1 [made Community Wiki]

This is not always a projective module. Here is the simplest counterexample I can think of, but there are plenty of others. Let $Y$ be $\text{Spec} k[x,y,z]$, where $k$ is a field. Let $X$ be the complement of the closed point $\langle x,y,z \rangle$. Then $\Gamma(X,\mathcal{O}_X)$ equals $k[x,y,z]$ since $k[x,y,z]$ is $S_2$.

Let $M$ be the $k[x,y,z]$-module that is the kernel of the homomorphism of finite free modules $k[x,y,z]^{\oplus 3} \to k[x,y,z]$ with matrix $[x,y,z]$. Using the Koszul complex, $M$ is also the cokernel of the transpose of this matrix. This is not a locally free module since the rank of $M/\langle x,y,z \rangle$ is $3$, whereas the rank of $M\otimes_{k[x,y,z]} k(x,y,z)$ equals $2$. The coherent sheaf $\widetilde{M}$ on $Y$ is not locally free. However, its restriction to the open subset $X$ is locally free. Moreover, $\Gamma(X,\widetilde{M}|_X)$ is just $M$ since $M$ is $S_2$.