Attention: Make a backup before your database . Ideally, you should run this on a test basis.
By the SQL Management Studio graphical interface:
As I said, run tests before running into production. If you can not do it on a test basis, then export only two stored procedures and see if it works.
Update
The DROP Script and CREATE option guarantees that a DROP will be generated for each object, just by giving DROP and creating again you will be able to perform this operation. You could use ALTER, but there is no such option in the script generator (at least in my version).
Another thing you need to check is whether the script generator will write to the file respecting the dependencies between the objects. This is important because you can not drop a function that is being used in a Stored Procedure. So, you need to drop SP first, then drop Function.
Update 2 (According to question update):
Regular expression in Notepad ++ version 6.4.5
In Notepad ++ there is the option of finding and replacing a text with regular expressions. To do this, press CTRL-F and use the Regular Expression option:
Step 1
Look for this:
\(NOLOCK\)
Replace with this:
WITH \(NOLOCK\)
2nd Step
Look for this:
(WITH\s+\(NOLOCK\))\s+(AS\s+[A-Z]+)
Replace with this:
Test :
In the 1st step, this:
Select * from QUOTE (NOLOCK) AS TB
It's transformed into this:
Select * from QUOTE WITH (NOLOCK) AS TB
That in step 2 is transformed into this:
Select * from QUOTE AS TB WITH (NOLOCK)
Explanation about Regular Expression :
(WITH\s+\(NOLOCK\))\s+(AS\s+[A-Z]+)
First let's break it into three pieces:
(WITH\s+\(NOLOCK\))
\s+
(AS\s+[A-Z]+)
Note that the 1st and 3rd pieces are delimited by paranteses. The 1st piece is called \ 1 and the 3rd piece is called \ 2. Record this.
1st piece:
WITH
\s+
\(NOLOCK\)
This piece is looking for the WITH string anywhere on the line. After that, all whitespace spaces (\ s +) are consumed until you find the string (NOLOCK). The backslashes are necessary to escape the character paranteses, since it is a reserved character.
2nd piece:
The second piece (\ s +) is just a way to traverse all spaces between (NOLOCK) and the AS word.
3rd piece:
AS
\s+
[A-Z]+
The 3rd piece finds the word AS that must necessarily come after 1 or several blanks (since it comes after the 2nd piece).
Once this is done, one or more white spaces are traversed until a word that has one or more characters (from A-Z) is found. This is the table name that comes after AS.
Replacement
As explained above, the regular expression is divided into two groups (the 1st and 3rd pieces). So the substitution is simply to rewrite the 3rd piece + a blank + 1st piece, like this: